<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/Public/Admin/extend/favicon.ico" >
    <link rel="Shortcut Icon" href="/Public/Admin/extend/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/Public/Admin/extend/lib/html5shiv.js"></script>
    <script type="text/javascript" src="/Public/Admin/extend/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/Public/Admin/extend/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/Public/Admin/extend/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/Public/Admin/extend/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/Public/Admin/extend/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/Public/Admin/extend/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="/Public/Admin/extend/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>用户添加</title>
    <link href="/Public/Admin/extend/lib/lightbox2/2.8.1/css/lightbox.css" rel="st ylesheet" type="text/css" >
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户管理 <span class="c-gray en">&gt;</span> 用户添加
    </nav>
<div class="page-container">
   <!--   <form class="form form-horizontal" id="form-agency" method="post" action='<?php echo U("Agency/userAdd");?>'> -->
     <form class="form form-horizontal" id="form-agency">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">用户名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="请输入用户名称" id="username" name="username">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">手机：</label>
             <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="请输入手机" id="mobile" name="mobile" >
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">登录密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" placeholder="请输入登录密码" id="password" name="password" minlength="6">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">确认密码：</label>
             <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" placeholder="请确认密码" id="comfirm_password" name="comfirm_password" minlength="6">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">用户等级：</label>
            <div class="formControls col-xs-8 col-sm-9">
                
                <select name="user_rank" id='userrank'>
                  <option value="0">请选择用户等级</option>
                  <option value="1">普通用户</option>
                  <option value="2">爱心用户</option>
                  <option value="3">医师</option>
                
                </select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">性别：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="radio" name="sex" id='sex' value="1" checked="checked">男
                <input type="radio" name="sex" id='sex' value="2">女
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">是否为特殊用户：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="radio" name="special" id='special' value="0" checked="checked">否
                <input type="radio" name="special" id='special' value="1">是
            </div>
        </div>
         <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">出生日期：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select id="selYear" name='year'></select>年
                <select id="selMonth" name='month'></select>月
                <select id="selDay" name='day'></select>日
            </div>
        </div>
        <!--  <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">推荐人ID：</label>
            <div class="formControls col-xs-8 col-sm-9">
                 <input type="text" class="input-text" placeholder="推荐人ID" id="parent_id" name="parent_id">
            </div>
        </div> -->
         
         <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">审核状态：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select name='status'>
                    <option value="0">请选择审核状态</option>
                    <option value="1">审核通过</option>
                    <option value="2">审核中</option>
                    <option value="3">审核不通过</option>  
                </select>
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input type="hidden" name="id" value="<?php echo ($res['user_id']); ?>">
                <input class="btn btn-primary radius" type="submit" id='sub' value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/Public/Admin/extend/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/Public/Admin/extend/lib/lightbox2/2.8.1/js/lightbox.min.js"></script>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/Public/Admin/extend/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="/Public/Admin/extend/lib/birthday.js"></script>
<script type="text/javascript">
    var selYear = window.document.getElementById("selYear");
    var selMonth = window.document.getElementById("selMonth");
    var selDay = window.document.getElementById("selDay");
    // 新建一个DateSelector类的实例，将三个select对象传进去
    new DateSelector(selYear, selMonth, selDay, 1995, 1, 17);
</script>
<script type="text/javascript">
    $(function(){
        $(".portfolio-area li").Huihover();
    });
     $("#sub").click(function(e){
        e.preventDefault();
        var username=$('#username').val(),mobile=$('#mobile').val(),pwd1=$("#password").val(),pwd2=$("#comfirm_password").val(),year=$('#selYear').val(),month=$('#selMonth').val(),day=$('#selDay').val(),rank=$('#userrank').val(),sex=$('input[name="sex"]:checked').val(),parent_id=$('#parent_id').val(),status=$('select[name="status"]').val(),special=$('input[name="special"]:checked').val();
         if(username==''){
             layer.msg('用户名不能为空',{icon: 2, time: 1000});
             return false;
          }    
        if(!(/^1[34578]\d{9}$/.test(mobile))){ 
           layer.msg('手机号码有误，请重填',{icon:2,time:1000});
           return false; 
        }   
        if(pwd1==''){
             layer.msg('密码不能为空',{icon:2,time:1000});
             return false;
        }
        if(pwd2==''){
             layer.msg('确认密码不能为空',{icon:2,time:1000});
             return false;
        }
        if(pwd1!=pwd2){
             layer.msg('两次输入的密码不一致!!',{icon:2,time:1000});
             return false;
        } 
          $.ajax({
            type: 'POST',
            url: '<?php echo U("Admin/User/userAdd");?>',
            data: {
                username:username,
                mobile:mobile,
                pwd1:pwd1,
                year:year,
                month:month,
                day:day,
                rank:rank,
                sex:sex,
                pid:parent_id,
                status:status,
                special:special,
            },
            dataType: 'json',
            success: function(data){
                layer.msg(data.info,{icon:1,time:1000});
                setTimeout((function() {
                    window.location.href='<?php echo U("Admin/User/userList");?>';
                }), 1000);
              
            },
            error:function(data) {
                console.log(data.msg);
            },
        });  
             
    })

    


</script>
</body>
</html>